package com.cynteka.cyfoman.ui;

import javax.swing.table.AbstractTableModel;

/**
 * Created by IntelliJ IDEA.
 * User: ukman
 * Date: 20.07.2011
 * Time: 19:56:38
 */ // The TableModel controls all the data:
public class DataModel extends AbstractTableModel {
    Object[][] data = {{"one", "two", "three", "four"},
            {"five", "six", "seven", "eight"},
            {"nine", "ten", "eleven", "twelve"},};
//    private JTableDemo jTableDemo;


    public DataModel() {
//        this.jTableDemo = jTableDemo;
//        addTableModelListener(new TML());
    }

    public int getColumnCount() {
        return data[0].length;
    }

    public int getRowCount() {
        return data.length;
    }

    public Object getValueAt(int row, int col) {
        return data[row][col];
    }

    public void setValueAt(Object val, int row, int col) {
        data[row][col] = val;
        // Indicate the change has happened:
        fireTableDataChanged();
    }

    public boolean isCellEditable(int row, int col) {
        return true;
    }

    @Override
    public String getColumnName(int column) {
        return "Column " + column;
    }
}
